home *** CD-ROM | disk | FTP | other *** search
- %!
- %%VMusage: 0 0
- %%VMlocation: global
- %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% %%
- %% CIDInit: the procedures used when defining CMap and CIDfont %%
- %% resources. The implementation is more or less defined by the %%
- %% requirement of the composefont procedure in systemdict. %%
- %% %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
- /CIDInit <<
-
- /cid_Setup {} bind
-
- /begincmap {
- /CodeSpace [] def
- /CIDRange [] def
- /CIDIndex 0 def
- /NotDefRange [] def
- /NotDefIndex 0 def
- /BFRange [] def
- /BFIndex 0 def
- /FontIndex 0 def
- /FontMatrices 1 dict def
- } bind
-
- /endcmap {
- currentdict systemdict begin definecmap end
- currentdict /CodeSpace undef
- currentdict /CIDRange undef
- currentdict /NotDefRange undef
- currentdict /BFRange undef
- } bind
-
- /beginrearrangedfont {
- 32 dict begin
- /FDepVector exch def
- /FontName exch def
- /FontMatrices 1 dict def
- begincmap
- } bind
-
- /endrearrangedfont {
- 0 1 FDepVector length 1 sub {
- /ind exch def
- FDepVector ind get
- dup type /nametype eq {
- dup /CIDFont resourcestatus {
- pop pop /CIDFont findresource
- } {
- findfont
- } ifelse
- } if
- FontMatrices ind known {
- FontMatrices ind get makefont
- } if
- FDepVector ind 3 -1 roll put
- } for
-
- FDepVector 0 get
- dup type /nametype eq {
- dup /CIDFont resourcestatus {
- pop pop /CIDFont findresource
- } {
- findfont
- } ifelse
- } if
- /WMode get /WMode exch def
- currentdict definerearrangedcmap
- currentdict /CodeSpace undef
- currentdict /CIDRange undef
- currentdict /NotDefRange undef
- currentdict /BFRange undef
- currentdict /FontMatrices undef
- FontName currentdict FDepVector
- end
- composefont
- } bind
-
- /usefont {
- /FontIndex exch def
- } bind
-
- /beginusematrix {
- } bind
-
- /endusematrix {
- FontMatrices 3 1 roll put
- } bind
-
- /usecmap {
- /UseCMap exch /CMap findresource def
- } bind
-
- /begincodespacerange {
- 2 mul CodeSpace length add array
- dup 0 CodeSpace putinterval
- /CodeSpace exch def
- mark
- } bind
-
- /endcodespacerange {
- ] dup length neg CodeSpace length add exch
- CodeSpace 3 1 roll putinterval
- } bind
-
- /begincidrange {
- 4 mul CIDIndex add array
- dup 0 CIDRange putinterval
- /CIDRange exch def
- } bind
-
- /begincidchar 1 index
-
- /endcidrange {
- CIDRange length 4 sub -4 CIDIndex {
- CIDRange 1 index 3 add 4 -1 roll put
- CIDRange 1 index 2 add FontIndex put
- CIDRange 1 index 1 add 4 -1 roll put
- CIDRange exch 3 -1 roll put
- } for
- /CIDIndex CIDRange length def
- } bind
-
- /endcidchar {
- CIDRange length 4 sub -4 CIDIndex {
- CIDRange 1 index 3 add 4 -1 roll put
- CIDRange 1 index 2 add FontIndex put
- CIDRange 1 index 1 add 3 index put
- CIDRange exch 3 -1 roll put
- } for
- /CIDIndex CIDRange length def
- } bind
-
- /beginbfrange {
- 4 mul BFIndex add array
- dup 0 BFRange putinterval
- /BFRange exch def
- } bind
-
- /beginbfchar 1 index
-
- /endbfrange {
- BFRange length 4 sub -4 BFIndex {
- BFRange 1 index 3 add 4 -1 roll put
- BFRange 1 index 2 add FontIndex put
- BFRange 1 index 1 add 4 -1 roll put
- BFRange exch 3 -1 roll put
- } for
- /BFIndex BFRange length def
- } bind
-
- /endbfchar {
- BFRange length 4 sub -4 BFIndex {
- BFRange 1 index 3 add 4 -1 roll put
- BFRange 1 index 2 add FontIndex put
- BFRange 1 index 1 add 3 index put
- BFRange exch 3 -1 roll put
- } for
- /BFIndex BFRange length def
- } bind
-
- /beginnotdefrange {
- 4 mul NotDefIndex add array
- dup 0 NotDefRange putinterval
- /NotDefRange exch def
- } bind
-
- /beginnotdefchar 1 index
-
- /endnotdefrange {
- NotDefRange length 4 sub -4 NotDefIndex {
- NotDefRange 1 index 3 add 4 -1 roll put
- NotDefRange 1 index 2 add FontIndex put
- NotDefRange 1 index 1 add 4 -1 roll put
- NotDefRange exch 3 -1 roll put
- } for
- /NotDefIndex NotDefRange length def
- } bind
-
-
- /endnotdefchar {
- NotDefRange length 4 sub -4 NotDefIndex {
- NotDefRange 1 index 3 add 4 -1 roll put
- NotDefRange 1 index 2 add FontIndex put
- NotDefRange 1 index 1 add 3 index put
- NotDefRange exch 3 -1 roll put
- } for
- /NotDefIndex NotDefRange length def
- } bind
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% %%
- %% StartData just builds an appropriate CIDFont dictionary and %%
- %% passes it to definefont. We take the lazy way out for %%
- %% hex-encoded CID fonts and read them into a GlyphData string, %%
- %% exploiting the fact that Jaws supports strings of arbitrary %%
- %% length. %%
- %% %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
- /StartData {
- %%
- %% This checks to see if we have been called as a result of
- %% FindResource. We leave 2 copies of the result on the stack.
- %% One is for the test against a seekable file, the other is
- %% for the end of the procedure, where we close currentfile
- %% but only if we were called as a result of FindResource
- %%
- false countexecstack array execstack {
- /@findresource eq {pop true exit} if
- } forall
- dup 4 2 roll
-
- /GlyphData exch def
- dup (hex) eq exch (Hex) eq or {
- /GlyphData GlyphData string def
- GlyphData length 0 ne {
- currentfile /ASCIIHexDecode filter GlyphData readstring pop pop
- } if
- pop
- } {
- currentglobal % remember the VM mode
- {currentfile fileposition} stopped
- 3 -1 roll setglobal % reinstate VM mode (in case fileposition errored)
- exch pop exch not or {
- currentglobal currentdict gcheck setglobal
- /GlyphData GlyphData string def
- setglobal
- GlyphData length 0 ne {
- currentfile GlyphData readstring pop pop
- } if
- } {
- /CIDFile currentfile def
- } ifelse
- } ifelse
- currentdict /CDevProc known not {
- currentglobal currentdict gcheck setglobal
- /CDevProc [
- /pop load dup dup dup dup 0 -1
- FDArray 0 get /FontMatrix get 0 get
- div 7 /index load 2 /div load 4 index -.88 mul] cvx
- def
- setglobal
- } if
- CIDFontName currentdict definefont
- CIDFontName end exch /CIDFont defineresource pop
- end
- {currentfile closefile} if
- } bind
-
- >> /ProcSet defineresource
-
-